package cn.tedu.supermarket.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;

@Controller
public class RedirectController {
    //用户
    @RequestMapping("/regNow")
    public ModelAndView reg(){ return new ModelAndView("buy_user/buserReg"); }

    @RequestMapping("/loginNow")
    public ModelAndView login(){ return new ModelAndView("buy_user/buserLogin");}

    @RequestMapping("/change")
    public ModelAndView test(){ return new ModelAndView("buy_user/buserChangePassword"); }

    //商家
    @RequestMapping("/sRegNow")
    public ModelAndView suserReg(){ return new ModelAndView("sel_user/suserReg"); }

    @RequestMapping("/sLoginNow")
    public ModelAndView suserLogin(){ return new ModelAndView("sel_user/suserLogin");}

    @RequestMapping("/changeSuser")
    public ModelAndView test1(){ return new ModelAndView("sel_user/suserChangePassword"); }

    @RequestMapping("/_add")
    public ModelAndView add1(HttpSession session){
        if (session.getAttribute("user")!=null){
            return new ModelAndView("sel_user/sendGoods");
        }
        return new ModelAndView("sel_user/suserLogin");
    }
}
